package com.zttek.videoShareProject.common.json;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.zttek.videoShareProject.modules.model.Video;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by ZYZ on 2018/7/10
 */
public class VideoJson {
    private static final long serialVersionUID = 1L;


    private Long videoId;
    private String title;
    private String intro;

    private String imageUrl;
    /**
     * 播放量
     */
    private Integer views;

    private String videoUrl;

    private String videoType;
    /**
     * 外键
     */

    private String userId;
    /**
     * 上传时间
     */

    private String uploadDate;
    /**
     * 视频时长
     */

    private Long totalTime;
    /**
     * 00:上传未审核，01：上传已审核，10：被举报
     */
    private String status;

    public VideoJson(Video video){

        this.videoId=video.getVideoId();
        this.title=video.getTitle();
        this.intro=video.getIntro();
        this.imageUrl=video.getImageUrl();
        this.videoUrl=video.getVideoUrl();
        this.videoType=video.getVideoType();
        this.userId=video.getUserId().toString();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());

        this.uploadDate=sdf.format(video.getUploadDate());
        this.totalTime=video.getTotalTime();
        if(video.getStatus()==00){
        this.status="未发布";}
        else if(video.getStatus()==01){
            this.status="已发布";
        }else{
            this.status="被举报";
        }
    }


    public Long getVideoId() {
        return videoId;
    }

    public void setVideoId(Long videoId) {
        this.videoId = videoId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public Integer getViews() {
        return views;
    }

    public void setViews(Integer views) {
        this.views = views;
    }

    public String getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
    }

    public String getVideoType() {
        return videoType;
    }

    public void setVideoType(String videoType) {
        this.videoType = videoType;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUploadDate() {
        return uploadDate;
    }


    public Long getTotalTime() {
        return totalTime;
    }

    public void setTotalTime(Long totalTime) {
        this.totalTime = totalTime;
    }

    public String getStatus() {
        return status;
    }



    @Override
    public String toString() {
        return "Video{" +
                "videoId=" + videoId +
                ", title=" + title +
                ", intro=" + intro +
                ", imageUrl=" + imageUrl +
                ", views=" + views +
                ", videoUrl=" + videoUrl +
                ", videoType=" + videoType +
                ", userId=" + userId +
                ", uploadDate=" + uploadDate +
                ", totalTime=" + totalTime +
                ", status=" + status +
                "}";
    }
}
